<template>
  <div class="ii-wrap">
    <!-- 左边 -->
    <div class="ii-wrap-left-l">
      <div class="ii-wrap-left-one" :class="platPreview === 1 ? 'ii-line-active && ii-text-active': ''" @click="toggleIndex(1)">全平台商品总览</div>
      <div class="ii-wrap-left-one" :class="platPreview === 2 ? 'ii-line-active && ii-text-active': ''" @click="toggleIndex(2)">订单总览</div>
      <div class="ii-wrap-left-one" :class="platPreview === 3 ? 'ii-line-active && ii-text-active': ''" @click="toggleIndex(3)">上传商品</div>
    </div>
    <!-- 右边 -->
    <div class="ii-wrap-right-r">
       <nuxt-child/>
    </div>
  </div>
</template>
<script>
export default {
  async fetch({store}) {
    await store.commit('setMultiPlat', 3)
  },
  layout: 'intermulti',
  components:{
    
  },
  data(){
    return{
      ksAccount: {},
    }
  },
  computed:{
    platPreview(){ //拿到平台预览
      return this.$store.state.platPreview
    }
  },
  methods:{
     toggleIndex(index){
      this.$store.commit('setPlatPreview',index)
      if(index===1){ //全平台商品总览
        this.go('/multiPlat/accountPreview')
      }else if(index === 2){ //订单总览
        this.$router.push({
          path:'/multiPlat/accountPreview/orderpreview',
        })
      }else if(index == 3){ //上传商品
        this.$router.push({
          path:'/multiPlat/accountPreview/uploadshop',
        })
      }
    },
  },
  mounted(){
    this.ksAccount = localStorage.getItem('ksAccount') ? JSON.parse(localStorage.getItem('ksAccount')):{}
  }
}
</script>

<style scoped>
/* 左边 */
  .ii-wrap{
    min-width: 1200px;
    margin:0 0 20px 0;
    display: flex;
    justify-content: space-between;
  }
  .ii-wrap-left-l{
    background: #efefef;
    width: 220px;
    border-radius: 4px;
    font-weight: bold;
    box-shadow:0 -4px 5px #f4f4f4;
  }
  .ii-wrap-left-one{
    height: 50px;
    border-bottom: 1px solid #f4f4f4;
    line-height: 50px;
    padding-left: 30px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    position: relative;
    user-select: none;
    font-weight:bold;
  }
  .ii-line-active::before {
    content: '';
    width: 3px;
    height: 26px;
    background: #0096e6;
    position: absolute;
    left: 0;
    top: 12px;
  }
  .ii-text-active{
    color: #0096e6 !important;
    background:#e6e6e6;
  }
  .ii-wrap-right-r{
    flex: 1;
    padding: 20px 20px 0;
    min-width: 940px;
    background: #fff;
    box-sizing: border-box;
    border-radius: 4px;
    margin: 20px;
  }
</style>
